<!DOCTYPE html>

<html>

<head>

    <title>安装包上传</title>

    <include file='public/head'>

	<style>

		.layui-legend-size{font-size:14px !important;}

		.layui-nopadding{padding:0 !important;}

		.layui-overflow{overflow:auto;}

		.layui-nomargin{margin: 0 !important;}

		.layui-bottom{border-bottom:1px solid rgb(226, 226, 226);}

		.layui-input{height:30px !important; }

		.layui-form-search-item .layui-inline{margin-bottom: 5px;} 

		.layui-form-search-item label{margin-left: 15px;}

		.layui-table-page {padding: 7px 0px 0px;}

		.layui-field-padding{border-width: 1px;padding:0 0 5px 10px;}

	</style>

</head>

<body>

	<!-- layui-tab开始 -->

	<div class="layui-tab " lay-filter="demo-tab" >

		<!-- 顶部导航菜单开始 -->


		<div class="layui-tab-nav" >

			<ul class="layui-tab-title">

				{:getNav('setting','admin_index/index')};

			</ul>

		</div>	


		<!-- 顶部导航菜单结束 -->



		<!-- 搜索栏结束 -->

	<h1 id="">山牛商城安装包上传</h1>

		<!-- 内容开始 -->

		<div class="layui-card">

			<form class="layui-form" action="" id="form1">

				<div class="layui-form-item">

					<label class="layui-form-label">版本号</label>

					<div class="layui-input-block">

						<input type="text" name="version" required  lay-verify="required" placeholder="版本号" autocomplete="off" class="layui-input">

					</div>

				</div>

				<div class="layui-form-item">

					<label class="layui-form-label">包类型</label>

					<div class="layui-input-block">

						<select name="type" lay-verify="required">

							<option value="1">安卓</option>

							<option value="2">苹果</option>

							<option value="3">热更新</option>

						</select>

					</div>

				</div>

				<div class="layui-form-item">

					<label class="layui-form-label">描述</label>

					<div class="layui-input-block">

							<textarea name="describle" placeholder="描述" class="layui-textarea"></textarea>

					</div>

				</div>

				<div class="layui-form-item">

					<label class="layui-form-label">上传文件</label>

					<div class="layui-input-block">

							<button type="button" class="layui-btn" id="test3"><i class="layui-icon"></i>上传文件</button>

							<input type="hidden" id="addr" name="download_addr" readonly value="" />

					</div>

				</div>

				<div class="layui-form-item">

                <div class="layui-input-block" id="tijiao" style="display:none;">

                  <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>

                  <button type="reset" class="layui-btn layui-btn-primary">重置</button>

                </div>

              </div>



			</form>

		</div>

		<!-- 内容结束 -->

	</div>

	<!-- layui-tab结束-->

	<include file='public/scripts'>



	<script >



	var form = layui.form

		,layer = layui.layer    //弹出层必需

		,layedit = layui.layedit  //富文本必需

		,laydate = layui.laydate  //日期选择必需

		,table = layui.table  //表格必需

		,element = layui.element;  //选项卡	





var upload = layui.upload;

		//指定允许上传的文件类型

	  upload.render({

	    elem: '#test3'

	    ,url: '{:cmf_plugin_url("Setting://admin_index/installPageUpload")}' //改成您自己的上传接口

	    ,accept: 'file' //普通文件

	    ,done: function(res){

	      layer.msg( res.message , function(){

	      	if( res.code ==200 ){

	      	    $( '#addr' ).val( res.save );

	      	    $( '#tijiao' ).show();

	      	}else{

	      	    $( '#tijiao' ).hide();

	      	}

	      });

	    }

	  });



 form.on('submit(formDemo)', function(data){



    $.post('{:cmf_plugin_url("Setting://admin_index/saveInfo")}' , data.field , function( res ){

        layer.msg( res.message , function(){

            if( res.code == 200 ){

                window.location.reload();

            }

        });

    });

    return false;

  });

	</script>





</body>

</html>